Add v4 media endpoint with AI video descriptions#1197
Closed
evanc wants to merge 1 commit intofronzbot:devfrom
Closed
Add v4 media endpoint with AI video descriptions#1197evanc wants to merge 1 commit intofronzbot:devfrom
evanc wants to merge 1 commit intofronzbot:devfrom
Conversation
ab0e0b8 to
63958cf
Compare
Use the v4 media endpoint (POST /api/v4/accounts/{id}/media) in
check_new_videos() to fetch AI video descriptions (Smart Video
Descriptions) and top-level CV detection labels from Blink's API.
The v4 endpoint returns richer data than v1, including:
- ai_vd: AI-generated video descriptions (full and short)
- cv_detection: computer vision detection labels (e.g. person, vehicle)
New camera attributes: ai_description, ai_description_short, cv_detection.
Also fixes clip URL handling for absolute URLs returned by v4.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
63958cf to
19009ab
Compare
Owner
|
SVDs are only available to premium subscribers and this PR would break compatibility for those that don't subscribe. Source: https://support.blinkforhome.com/en_US/motion-detection/using-blink-video-descriptions For that reason I'm going to have to deny the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blink cameras have a new feature called Smart Video Descriptions (SVD) - the camera generates a short AI-written summary of each motion clip, like "A person is walking on the driveway" or "A delivery truck has arrived." These descriptions show up in the official Blink app, but blinkpy currently can't access them because they're only available through the newer v4 media endpoint.
This PR switches the media fetch from the legacy v1 endpoint to the v4 endpoint (
POST /api/v4/accounts/{id}/media), which returns richer data including:ai_vd— AI video descriptions with both a full and short summarycv_detection— Computer vision labels (e.g.,["person"],["vehicle"])smart_video_descriptions— Account-level flag indicating SVD is enabledThe v4 endpoint is what the official Blink app already uses today; the v1 endpoint simply doesn't include these fields.
What changed
api.py— Addedrequest_videos_v4()function for the v4 media POST endpointsync_module.py—check_new_videos()now calls the v4 endpoint and extractsai_vdandcv_detectionfrom each media entry. Since v4 doesn't support the?since=server-side filter that v1 had, client-side time filtering (which already existed viacheck_new_video_time()) handles this cleanly.camera.py— Addedai_description,ai_description_short, andcv_detectionattributes. Also fixed a URL-doubling bug: v4 returns absolute clip URLs (unlike v1's relative paths), so the code now checks before prependingbase_url.tests/test_ai_descriptions.py— 12 new tests covering the v4 API call, AI field extraction (present, absent, empty), camera attribute population, recent clips, and the absolute/relative URL handling.tests/test_camera_functions.py— Updatedrecent_clipsexpected shape to include the new fields.Backward compatibility
For accounts without SVD enabled,
ai_vdcomes back asNoneand the fields are simply omitted — no errors, no empty strings. Thecv_detectionand AI description attributes on the camera object default toNoneuntil populated, so existing integrations won't break.Test plan
pytest— 230 tests pass (218 existing + 12 new)ruff check— cleanblack --check— clean